

set more off
cd "C:\Users\imberman\Dropbox\Texas Majors\Major Earnings Trajectories and Variability\Results\Utility model"


**4 YR
use simulation_results_quantiles_4yr, clear

gen majornum = .
replace majornum = 9 if major == "ag"
replace majornum = 8 if major == "bio"
replace majornum = 7 if major == "bus"
replace majornum = 6 if major == "com"
replace majornum = 5 if major == "eng"
replace majornum = 4 if major == "it"
replace majornum = 3 if major == "sci"
replace majornum = 2 if major == "soc"
replace majornum = 1 if major == "voc"
# delimit ;


*REMOVE UNDECLARED;
drop if major == "und";

****COMPARING ACROSS SCENARIOS FOR GIVEN GAMMA AND HETEROGENEITY***;


***LOOP OVER QUANTILES;
foreach quantiles of numlist 0 1 {;

*LOOP OVER GAMMA;
foreach gamma of numlist 0.75 3 {;
 local gamma10 = `gamma'*100;

*LOOP OVER DISCOUNTRATE;
foreach discount of numlist .99 {;
  local discount2 = `discount' + 0.001;
  local discount10000 = `discount'*10000;

twoway (scatter majornum relutility if discountrate >= `discount' & discountrate < `discount2' & gamma == `gamma' & quantiles == `quantiles' & scenario == "Certainty, No Saving", msymbol(diamond) mcolor(forest_green))
		(scatter majornum relutility if discountrate >= `discount' & discountrate < `discount2' & gamma == `gamma' & quantiles == `quantiles' & scenario == "Permanent Income Hyp", msymbol(circle) mcolor(maroon))
		(scatter majornum relutility if discountrate >= `discount' & discountrate < `discount2' & gamma == `gamma' & quantiles == `quantiles' & scenario == "Uncertainty, No Savi", msymbol(triangle) mcolor(navy)
				graphregion(color(white))
				ylabel(1 "Vocational" 2 "Social Science" 3  "Science" 4 "IT" 5 "Engineering/Architecure" 6 "Communciations" 7 "Business/Econ"  8 "Bio/Health" 9 "Agriculture", angle(45))
				ytitle("Major")
				xtitle("(U(Major) - U(Libarts))/|U(Libarts)|")
				legend(order(1 "Certainty, No Savings" 2 "PIH" 3 "Uncertainty, No Savings"))
				);
graph save "C:\Users\imberman\Dropbox\Texas Majors\Major Earnings Trajectories and Variability\Results\Utility model\Figures\quantiles`quantiles'_gamma`gamma10'_discount`discount10000'_4yr", replace;
graph export "C:\Users\imberman\Dropbox\Texas Majors\Major Earnings Trajectories and Variability\Results\Utility model\Figures\quantiles`quantiles'_gamma`gamma10'_discount`discount10000'_4yr.pdf", as(pdf) replace;


};
};
};


***COMPARING ACROSS GAMMA FOR GIVEN SCENARIO, AND HETEROGENEITY***

***LOOP OVER QUANTILES;
foreach quantiles of numlist 0 1 {;

*LOOP OVER SCENARIO;
foreach scenario in "Certainty, No Saving"  "Permanent Income Hyp"  "Uncertainty, No Savi" {;
 if  "`scenario'" == "Certainty, No Saving" local scenarioshort = "cert" ;
 if  "`scenario'" == "Permanent Income Hyp" local scenarioshort = "pih" ;
 if  "`scenario'" == "Uncertainty, No Savi" local scenarioshort = "uncert";


*LOOP OVER DISCOUNTRATE;
foreach discount of numlist .99 {;
  local discount2 = `discount' + 0.001;
  local discount10000 = `discount'*10000;

twoway (scatter majornum relutility if discountrate >= `discount' & discountrate < `discount2' & gamma == 0.75 & quantiles == `quantiles' & scenario == "`scenario'", msymbol(diamond) mcolor(orange))
		(scatter majornum relutility if discountrate >= `discount' & discountrate < `discount2' & gamma == 1.5 & quantiles == `quantiles' & scenario == "`scenario'", msymbol(circle) mcolor(purple))
		(scatter majornum relutility if discountrate >= `discount' & discountrate < `discount2' & gamma == 2 & quantiles == `quantiles' & scenario == "`scenario'", msymbol(square) mcolor(olive))
		(scatter majornum relutility if discountrate >= `discount' & discountrate < `discount2' & gamma == 3 & quantiles == `quantiles' & scenario == "`scenario'", msymbol(triangle) mcolor(khaki)
				graphregion(color(white))
				ylabel(1 "Vocational" 2 "Social Science" 3  "Science" 4 "IT" 5 "Engineering/Architecure" 6 "Communciations" 7 "Business/Econ"  8 "Bio/Health" 9 "Agriculture", angle(45))
				ytitle("Major")
				xtitle("(U(Major) - U(Libarts))/|U(Libarts)|")
				legend(order(1 "CRRA = 0.75" 2 "CRRA = 1.5" 3 "CRRA = 2" 4 "CRRA = 3"))
				xlabel(-0.5(0.5)1)
				);
graph save "C:\Users\imberman\Dropbox\Texas Majors\Major Earnings Trajectories and Variability\Results\Utility model\Figures\quantiles`quantiles'_`scenarioshort'_discount`discount10000'_4yr", replace;
graph export "C:\Users\imberman\Dropbox\Texas Majors\Major Earnings Trajectories and Variability\Results\Utility model\Figures\quantiles`quantiles'_`scenarioshort'_discount`discount10000'_4yr.pdf", as(pdf) replace;


};
};
};

***COMPARING ACROSS DISCOUNT RATES FOR GIVEN SCENARIO, AND GAMMA***

***LOOP OVER QUANTILES;
foreach quantiles of numlist 0 1 {;

*LOOP OVER SCENARIO;
foreach scenario in "Certainty, No Saving"  "Permanent Income Hyp"  "Uncertainty, No Savi" {;
 if  "`scenario'" == "Certainty, No Saving" local scenarioshort = "cert" ;
 if  "`scenario'" == "Permanent Income Hyp" local scenarioshort = "pih" ;
 if  "`scenario'" == "Uncertainty, No Savi" local scenarioshort = "uncert";

twoway (scatter majornum relutility if discountrate >= 0.99 & discountrate < 0.991 & gamma == 0.75 & quantiles == `quantiles' & scenario == "`scenario'", msymbol(diamond) mcolor(maroon))
		(scatter majornum relutility if discountrate >= 0.99 & discountrate < 0.991  & gamma == 3 & quantiles == `quantiles' & scenario == "`scenario'", msymbol(diamond_hollow) mcolor(navy))
		(scatter majornum relutility if discountrate >= 0.995 & discountrate < 0.996  & gamma == 0.75 & quantiles == `quantiles' & scenario == "`scenario'", msymbol(circle) mcolor(maroon))
		(scatter majornum relutility if discountrate >= 0.995 & discountrate < 0.996  & gamma == 3 & quantiles == `quantiles' & scenario == "`scenario'", msymbol(circle_hollow) mcolor(navy))
		(scatter majornum relutility if discountrate >= 0.9975 & discountrate < 0.998  & gamma == 0.75 & quantiles == `quantiles' & scenario == "`scenario'", msymbol(square) mcolor(maroon))
		(scatter majornum relutility if discountrate >= 0.9975 & discountrate < 0.998  & gamma == 3 & quantiles == `quantiles' & scenario == "`scenario'", msymbol(square_hollow) mcolor(navy)
				graphregion(color(white))
				ylabel(1 "Vocational" 2 "Social Science" 3  "Science" 4 "IT" 5 "Engineering/Architecure" 6 "Communciations" 7 "Business/Econ"  8 "Bio/Health" 9 "Agriculture", angle(45))
				ytitle("Major")
				xtitle("(U(Major) - U(Libarts))/|U(Libarts)|")
				legend(order(1 "CRRA = 0.75, DR = 0.99" 2 "CRRA = 3, DR = 0.99" 3 "CRRA = 0.75, DR = 0.995" 4 "CRRA = 3, DR = 0.995" 5 "CRRA = 0.75, DR = 0.9975" 6 "CRRA = 3, DR = 0.9975" ))
				);
graph save "C:\Users\imberman\Dropbox\Texas Majors\Major Earnings Trajectories and Variability\Results\Utility model\Figures\quantiles`quantiles'_`scenarioshort'_discountgamma_4yr", replace;
graph export "C:\Users\imberman\Dropbox\Texas Majors\Major Earnings Trajectories and Variability\Results\Utility model\Figures\quantiles`quantiles'_`scenarioshort'__discountgamma_4yr.pdf", as(pdf) replace;


};
};




# delimit cr




**2 YR
use simulation_results_quantiles_2yr, clear

gen majornum = .
replace majornum = 10 if major == "ag"
replace majornum = 9 if major == "bio"
replace majornum = 8 if major == "bus"
replace majornum = 7 if major == "com"
replace majornum = 6 if major == "educ"
replace majornum = 5 if major == "eng"
replace majornum = 4 if major == "it"
replace majornum = 3 if major == "sci"
replace majornum = 2 if major == "soc"
replace majornum = 1 if major == "voc"
# delimit ;


*REMOVE UNDECLARED;
drop if major == "und";


****COMPARING ACROSS SCENARIOS FOR GIVEN GAMMA AND HETEROGENEITY***;


***LOOP OVER QUANTILES;
foreach quantiles of numlist 0 1 {;

*LOOP OVER GAMMA;
foreach gamma of numlist 0 0.75 3 {;
 local gamma10 = `gamma'*100;

*LOOP OVER DISCOUNTRATE;
foreach discount of numlist .99 {;
  local discount2 = `discount' + 0.001;
  local discount10000 = `discount'*10000;


twoway (scatter majornum relutility if discountrate >= `discount' & discountrate < `discount2' & gamma == `gamma' & quantiles == `quantiles' & scenario == "Certainty, No Saving", msymbol(diamond) mcolor(forest_green))
		(scatter majornum relutility if discountrate >= `discount' & discountrate < `discount2' & gamma == `gamma' & quantiles == `quantiles' & scenario == "Permanent Income Hyp", msymbol(circle) mcolor(maroon))
		(scatter majornum relutility if discountrate >= `discount' & discountrate < `discount2' & gamma == `gamma' & quantiles == `quantiles' & scenario == "Uncertainty, No Savi", msymbol(triangle) mcolor(navy)				graphregion(color(white))
				ylabel(1 "Vocational" 2 "Social Science" 3  "Science" 4 "IT"  5 "Engineering/Architecure" 6 "Education"   7 "Communciations"  8 "Business/Econ"  9 "Bio/Health" 10 "Agriculture", angle(45))
				ytitle("Major")
				xtitle("(U(Major) - U(Libarts))/|U(Libarts)|")
				legend(order(1 "Certainty, No Savings" 2 "PIH" 3 "Uncertainty, No Savings"))
				);
graph save "C:\Users\imberman\Dropbox\Texas Majors\Major Earnings Trajectories and Variability\Results\Utility model\Figures\quantiles`quantiles'_gamma`gamma10'_discount`discount10000'_2yr", replace;
graph export "C:\Users\imberman\Dropbox\Texas Majors\Major Earnings Trajectories and Variability\Results\Utility model\Figures\quantiles`quantiles'_gamma`gamma10'_discount`discount10000'_2yr.pdf", as(pdf) replace;


};
};
};

***COMPARING ACROSS GAMMA FOR GIVEN SCENARIO, AND HETEROGENEITY***

***LOOP OVER QUANTILES;
foreach quantiles of numlist 0 1 {;

*LOOP OVER SCENARIO;
foreach scenario in "Certainty, No Saving"  "Permanent Income Hyp"  "Uncertainty, No Savi" {;
 if  "`scenario'" == "Certainty, No Saving" local scenarioshort = "cert" ;
 if  "`scenario'" == "Permanent Income Hyp" local scenarioshort = "pih" ;
 if  "`scenario'" == "Uncertainty, No Savi" local scenarioshort = "uncert";


*LOOP OVER DISCOUNTRATE;
foreach discount of numlist .99 {;
  local discount2 = `discount' + 0.001;
  local discount10000 = `discount'*10000;

twoway (scatter majornum relutility if discountrate >= `discount' & discountrate < `discount2' & gamma == 0.75 & quantiles == `quantiles' & scenario == "`scenario'", msymbol(diamond) mcolor(orange))
		(scatter majornum relutility if discountrate >= `discount' & discountrate < `discount2' & gamma == 1.5 & quantiles == `quantiles' & scenario == "`scenario'", msymbol(circle) mcolor(purple))
		(scatter majornum relutility if discountrate >= `discount' & discountrate < `discount2' & gamma == 2 & quantiles == `quantiles' & scenario == "`scenario'", msymbol(square) mcolor(olive))
		(scatter majornum relutility if discountrate >= `discount' & discountrate < `discount2' & gamma == 3 & quantiles == `quantiles' & scenario == "`scenario'", msymbol(triangle) mcolor(khaki)
				graphregion(color(white))
				ylabel(1 "Vocational" 2 "Social Science" 3  "Science" 4 "IT"  5 "Engineering/Architecure" 6 "Education"   7 "Communciations"  8 "Business/Econ"  9 "Bio/Health" 10 "Agriculture", angle(45))
				ytitle("Major")
				xtitle("(U(Major) - U(Libarts))/|U(Libarts)|")
				legend(order(1 "CRRA = 0.75" 2 "CRRA = 1.5" 3 "CRRA = 2" 4 "CRRA = 3"))
				);
graph save "C:\Users\imberman\Dropbox\Texas Majors\Major Earnings Trajectories and Variability\Results\Utility model\Figures\quantiles`quantiles'_`scenarioshort'_discount`discount10000'_2yr", replace;
graph export "C:\Users\imberman\Dropbox\Texas Majors\Major Earnings Trajectories and Variability\Results\Utility model\Figures\quantiles`quantiles'_`scenarioshort'_discount`discount10000'_2yr.pdf", as(pdf) replace;


};
};
};


***COMPARING ACROSS DISCOUNT RATES FOR GIVEN SCENARIO, AND GAMMA***

***LOOP OVER QUANTILES;
foreach quantiles of numlist 0 1 {;

*LOOP OVER SCENARIO;
foreach scenario in "Certainty, No Saving"  "Permanent Income Hyp"  "Uncertainty, No Savi" {;
 if  "`scenario'" == "Certainty, No Saving" local scenarioshort = "cert" ;
 if  "`scenario'" == "Permanent Income Hyp" local scenarioshort = "pih" ;
 if  "`scenario'" == "Uncertainty, No Savi" local scenarioshort = "uncert";

twoway (scatter majornum relutility if discountrate >= 0.99 & discountrate < 0.991 & gamma == 0.75 & quantiles == `quantiles' & scenario == "`scenario'", msymbol(diamond) mcolor(maroon))
		(scatter majornum relutility if discountrate >= 0.99 & discountrate < 0.991  & gamma == 3 & quantiles == `quantiles' & scenario == "`scenario'", msymbol(diamond_hollow) mcolor(navy))
		(scatter majornum relutility if discountrate >= 0.995 & discountrate < 0.996  & gamma == 0.75 & quantiles == `quantiles' & scenario == "`scenario'", msymbol(circle) mcolor(maroon))
		(scatter majornum relutility if discountrate >= 0.995 & discountrate < 0.996  & gamma == 3 & quantiles == `quantiles' & scenario == "`scenario'", msymbol(circle_hollow) mcolor(navy))
		(scatter majornum relutility if discountrate >= 0.9975 & discountrate < 0.998  & gamma == 0.75 & quantiles == `quantiles' & scenario == "`scenario'", msymbol(square) mcolor(maroon))
		(scatter majornum relutility if discountrate >= 0.9975 & discountrate < 0.998  & gamma == 3 & quantiles == `quantiles' & scenario == "`scenario'", msymbol(square_hollow) mcolor(navy)
				graphregion(color(white))
				ylabel(1 "Vocational" 2 "Social Science" 3  "Science" 4 "IT"  5 "Engineering/Architecure" 6 "Education"   7 "Communciations"  8 "Business/Econ"  9 "Bio/Health" 10 "Agriculture", angle(45))
				ytitle("Major")
				xtitle("(U(Major) - U(Libarts))/|U(Libarts)|")
				legend(order(1 "CRRA = 0.75, DR = 0.99" 2 "CRRA = 3, DR = 0.99" 3 "CRRA = 0.75, DR = 0.995" 4 "CRRA = 3, DR = 0.995" 5 "CRRA = 0.75, DR = 0.9975" 6 "CRRA = 3, DR = 0.9975" ))
				);
graph save "C:\Users\imberman\Dropbox\Texas Majors\Major Earnings Trajectories and Variability\Results\Utility model\Figures\quantiles`quantiles'_`scenarioshort'_discountgamma_2yr", replace;
graph export "C:\Users\imberman\Dropbox\Texas Majors\Major Earnings Trajectories and Variability\Results\Utility model\Figures\quantiles`quantiles'_`scenarioshort'__discountgamma_2yr.pdf", as(pdf) replace;


};
};



# delimit cr
